	<include file='Common:header' />

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">

			<!-- #section:basics/sidebar -->

	<include file='Common:left' />
			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">
					
							<div class="row maintop">
							<div class="col-xs-12 col-sm-1">
<!-- 点击模态框（Modal） -->
								<button class="btn btn-xs btn-danger" data-toggle="modal" data-target="#myModal">
									<i class="ace-icon fa fa-bolt bigger-110"></i>
										添加关键字
								</button>
								
							</div>

								<div class="col-xs-12 col-sm-5">
								<form name="we_reply_text" class="form-search" method="post" action="__URL__/we_reply_pic">
									<div class="input-group">
										<span class="input-group-addon">
											<i class="ace-icon fa fa-check"></i>
										</span>
										<input type="text" name="key" id="key" class="form-control search-query admin_sea" value="{$val}" placeholder="输入关键字查询" />
										<span class="input-group-btn">
											<button type="submit" class="btn btn-xs  btn-purple">
												<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
												搜索
											</button>
										</span>
									</div>
								</form>
								</div>
								  <div class="input-group-btn">
									<a href="__URL__/we_reply_pic">
									<button type="button" class="btn btn-xs  btn-purple">
										<span class="ace-icon fa fa-globe icon-on-right bigger-110"></span>
										显示全部
									</button>
									</a>
								  </div>
							</div>
		

							<div class="row">
							    <div class="col-xs-12">
										<div>
										
	
										  <table width="100%" class="table table-striped table-bordered table-hover" id="dynamic-table">
                                              <thead>
                                                <tr>
                                                  <th width="5%">编号：</th>
                                                  <th width="24%">关键字</th>
                                                  <th width="18%">添加时间</th>
                                                  <th width="14%">回复内容</th>
                                                  <th width="8%">状态</th>
                                                  <th width="6%" style="border-right:#CCC solid 1px;">操作</th>
                                                </tr>
                                              </thead>
                     <style type="text/css">
.thumbnew img{position:absolute;left:0px;visibility:hidden;padding:5px;z-index:9999;}
.thumbnew:hover img{visibility:visible;top:20px;left:0px;}
</style>
                                              <tbody>
                                                <foreach name="we_reply_list" item="v">
                                                  <tr>
                                                    <td height="28" >{$v.we_reply_id}</td>
                                                    <td>{$v.we_reply_key}</td>
                                                    <td>{$v.we_reply_addtime|date="Y-m-d H:i:s",###}</td>

                                                    <td><a class="thumbnew" href="#"><span id="mainCon" class="label label-success arrowed">鼠标经过，查看缩略图<img src="__PUBLIC__/{$v.we_replynews_image}"  width="300"/></span></a></td>
                                                    <td></td>
                                                    <td>
<div class="action-buttons">
		<a class="green"  href="javascript:;" onclick="return we_replypic_edit({$v.we_reply_id},{:I('p',1)});"  title="修改">
			<i class="ace-icon fa fa-pencil bigger-130"></i>		</a>
		<a class="red" href="javascript:;" onclick="return del({$v.we_reply_id},{:I('p',1)});" title="删除">
			<i class="ace-icon fa fa-trash-o bigger-130"></i>
		</a>
</div>
													</td>
                                                  </tr>
                                                </foreach>
                                                <tr>
                                                  <td height="50" colspan="6" align="right">{$page}</td>
                                                </tr>
                                              </tbody>
                                            </table>

										</div>
							  </div>
								</div>

<include file='Common:header_nav' />

					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->

<!-- 显示模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<form class="form-horizontal" name="we_replypic_runadd" id="we_replypic_runadd" method="post" action="__URL__/we_replypic_runadd" enctype="multipart/form-data">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">×
            </button>
            <h4 class="modal-title" id="myModalLabel">
               添加回复关键字
            </h4>
         </div>
         <div class="modal-body">
            
			
						<div class="row">
							<div class="col-xs-12">
																		
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 输入关键字：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_reply_key" id="we_reply_key" placeholder="输入关键字" class="col-xs-10 col-sm-7" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>必填</span>
										</div>
									</div>
                                    <div class="space-4"></div>
									
									
    <link href="__PUBLIC__/ppy/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />	
    <script src="__PUBLIC__/ppy/js/fileinput.js" type="text/javascript"></script>
    <script src="__PUBLIC__/ppy/js/fileinput_locale_zh.js" type="text/javascript"></script>
	
	
									

                                    <div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 标题：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_replynews_title" id="we_replynews_title" placeholder="输入图文消息标题" class="col-xs-10 col-sm-7" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>图文消息标题不能为空</span>
										</div>
									</div>
                                    <div class="space-4"></div>

                                    <div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 摘要：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_replynews_abs" id="we_replynews_abs" placeholder="输入摘要" class="col-xs-10 col-sm-7" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>摘要</span>
										</div>
									</div>
                                    <div class="space-4"></div>

                                    <div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图文信息链接：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_replynews_url" id="we_replynews_url" placeholder="微信官方后台的图文素材的url" class="col-xs-10 col-sm-7" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>必填</span>
										</div>
									</div>
                                    <div class="space-4"></div>

                                    <div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 封面图片 ：  </label>
									  <div class="col-sm-10">
										  <input id="file-0b" name="we_replynews_image" class="file" type="file">
										</div>
									</div>
                                    <div class="space-4"></div>
									
								</div>
							</div>
			
         </div>
         <div class="modal-footer">
		 	<button type="submit" class="btn btn-primary">
            	提交保存
            </button>
		 	<button class="btn btn-info" type="reset">
				重置
			</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">
				关闭
            </button>
         </div>
      </div><!-- /.modal-content -->
   </div><!-- /.modal-dialog -->
   </form>
</div><!-- /.modal -->






<!-- 显示模态框（Modal） -->
<div class="modal fade in" id="myModaledit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-backdrop fade in" id="gbbb" style="height:100%;"></div>
<form class="form-horizontal" name="we_replypic_runedit22" id="we_replypic_runedit" method="post" action="__URL__/we_replypic_runedit"enctype="multipart/form-data">
<input type="hidden" name="we_reply_id" id="e_we_reply_id" value="" />
<input type="hidden" name="p" id="e_p" />
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" id="gb"  data-dismiss="modal" 
               aria-hidden="true">×
            </button>
            <h4 class="modal-title" id="myModalLabel">
               修改回复关键字
            </h4>
         </div>
         <div class="modal-body">
            
			
						<div class="row">
							<div class="col-xs-12">
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 输入关键字：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_reply_key" id="e_we_reply_key" placeholder="输入关键字" class="col-xs-10 col-sm-7" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>必填</span>
										</div>
									</div>
                                    <div class="space-4"></div>

                                    <div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 标题：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_replynews_title" id="e_we_replynews_title" placeholder="输入图文消息标题" class="col-xs-10 col-sm-7" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>图文消息标题不能为空</span>
										</div>
									</div>
                                    <div class="space-4"></div>

                                    <div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 摘要：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_replynews_abs" id="e_we_replynews_abs" placeholder="输入摘要" class="col-xs-10 col-sm-7" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>摘要</span>
										</div>
									</div>
                                    <div class="space-4"></div>

                                    <div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图文信息链接：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_replynews_url" id="e_we_replynews_url" placeholder="微信官方后台的图文素材的url" class="col-xs-10 col-sm-7" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>必填</span>
										</div>
									</div>
                                    <div class="space-4"></div>

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 回复图片 ：</label>
									  <div class="col-sm-10">
										  <input id="file-0b" name="we_replynews_image" class="file" type="file"><br />
									<span style="color:#FF0000">*若不修改图片，请留空</span>  
										</div>
									</div><!-- 
                                    <div class="space-4"></div> -->
									
								</div>
							</div>
			
			
			
			
         </div>
         <div class="modal-footer">
		 	<button type="submit" class="btn btn-primary">
            	提交保存
            </button>
            <button type="button" class="btn btn-default"  id="gbb" >
				关闭
            </button>
         </div>
      </div><!-- /.modal-content -->
   </div><!-- /.modal-dialog -->
   </form>
</div><!-- /.modal -->



<script>
function del(id,p){
	layer.confirm('你确定要删除吗？', {icon: 3}, function(index){
	layer.close(index);
	window.location.href="__URL__/we_reply_pic_del/we_reply_id/"+id+"/p/"+p+"";
	});
}

$(function(){
	$('#we_replypic_runadd').ajaxForm({
		beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: complete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function checkForm(){
		if( '' == $.trim($('#we_reply_key').val())){
			layer.alert('回复关键字不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#we_reply_key').focus(); 
			});
			return false;
		}
		
		if( '' == $.trim($('#we_replynews_title').val())){
			layer.alert('标题不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#we_replynews_title').focus(); 
			});
			return false;
		}
		if( '' == $.trim($('#we_replynews_abs').val())){
			layer.alert('摘要不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#we_replynews_abs').focus(); 
			});
			return false;
		}
		if( '' == $.trim($('#we_replynews_url').val())){
			layer.alert('内容链接不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#we_replynews_url').focus(); 
			});
			return false;
		}
 }
	function complete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}else{
			alert(data.info);
			return false;	
		}
	}
});


//修改模态框状态
$(document).ready(function(){
	$("#myModaledit").hide();
	$("#gb").click(function(){
		$("#myModaledit").hide(200);
	});
	$("#gbb").click(function(){
		$("#myModaledit").hide(200);
	});
	$("#gbbb").click(function(){
		$("#myModaledit").hide(200);
	});
});

function we_replypic_edit(val,p){
		  $.post('{:U("we_replypic_edit")}',
		  {we_reply_id:val,p_l:p},
	function(data){
		//alert(JSON.stringify(data));
		if(data.status==1){
			$(document).ready(function()
			{
				$("#myModaledit").show(300);
				$("#e_we_reply_id").val(data.we_reply_id);
				$("#e_we_reply_key").val(data.we_reply_key);
				$("#e_we_replynews_title").val(data.we_replynews_title);
				$("#e_we_replynews_abs").val(data.we_replynews_abs);
				$("#e_we_replynews_url").val(data.we_replynews_url);
				$("#e_we_replynews_image").val(data.we_replynews_image);
				$("#e_p").val(data.p);
			});
		}
	});
	//return false;
}

$(function(){
	$('#we_replypic_runedit').ajaxForm({
		beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: complete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function checkForm(){
		if( '' == $.trim($('#e_we_reply_key').val())){
			layer.alert('回复关键字不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#e_we_reply_key').focus(); 
			});
			return false;
		}
		
		if( '' == $.trim($('#e_we_replynews_title').val())){
			layer.alert('标题不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#e_we_replynews_title').focus(); 
			});
			return false;
		}
		if( '' == $.trim($('#e_we_replynews_abs').val())){
			layer.alert('摘要不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#e_we_replynews_abs').focus(); 
			});
			return false;
		}
		if( '' == $.trim($('#e_we_replynews_url').val())){
			layer.alert('内容链接不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#e_we_replynews_url').focus(); 
			});
			return false;
		}
 }
	function complete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}else{
			alert(data.info);
			return false;	
		}
	}
});
</script>
	<include file='Common:footer' />
    
		</div><!-- /.main-container -->
	</body>
</html>
